package com.arpa.oms.domain.entity;

import com.arpa.wms.domain.entity.BasicEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * OMS销售退货单
 * </p>
 *
 * @author LEO
 * @since 2020-11-17
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="OmsSaleReturn对象", description="OMS销售退货单")
public class OmsSaleReturn extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "采购退货单号")
    @TableField("code")
    @NotEmpty(message = "单号不能为空！", groups = {Update.class})
    private String code;

    @ApiModelProperty(value = "仓库code")
    @TableField("warehouse_code")
    @NotEmpty(message = "仓库不能为空！", groups = {Save.class})
    private String warehouseCode;

    @ApiModelProperty(value = "货主code")
    @TableField("shipment_code")
    @NotEmpty(message = "货主不能为空！", groups = {Save.class})
    private String shipmentCode;

    @ApiModelProperty(value = "货主名称")
    @TableField("shipment_name")
    private String shipmentName;

    @ApiModelProperty(value = "所属机构标识")
    @TableField("group_code")
    private String groupCode;

    @ApiModelProperty(value = "客户标识")
    @TableField("customer_code")
    @NotEmpty(message = "客户不能为空！", groups = {Save.class})
    private String customerCode;

    @ApiModelProperty(value = "客户名称")
    @TableField("customer_name")
    private String customerName;

    @ApiModelProperty(value = "销售单号")
    @TableField("source_code")
    @NotEmpty(message = "来源单号不能为空！", groups = {Save.class})
    private String sourceCode;

    @ApiModelProperty(value = "单据类型")
    @TableField("type")
    private String type;

    @ApiModelProperty(value = "计划退货数量（退货单位）")
    @TableField("plan_quantity")
    private BigDecimal planQuantity;

    @ApiModelProperty(value = "计划退货数量（基本单位）")
    @TableField("plan_basic_quantity")
    private BigDecimal planBasicQuantity;

    @ApiModelProperty(value = "实退货购数量（退货单位）")
    @TableField("actual_quantity")
    private BigDecimal actualQuantity;

    @ApiModelProperty(value = "实退货购数量（基本单位）")
    @TableField("actual_basic_quantity")
    private BigDecimal actualBasicQuantity;

    @ApiModelProperty(value = "状态：新增、作废、待审核、审核通过、审核不通过")
    @TableField("status")
    private String status;

    @ApiModelProperty(value = "审核意见")
    @TableField("verify_opinion")
    private String verifyOpinion;

    @ApiModelProperty(value = "审核时间")
    @TableField("gmt_verify")
    private LocalDateTime gmtVerify;

    @ApiModelProperty(value = "审核人")
    @TableField("verify_by")
    private String verifyBy;

    @ApiModelProperty(value = "审核人姓名")
    @TableField("verify_name")
    private String verifyName;

    @ApiModelProperty(value = "备注")
    @TableField("remarks")
    @Length(max = 255, message = "备注最多输入255个字符")
    private String remarks;

    @ApiModelProperty(value = "子单明细")
    @TableField(exist = false)
    @Valid
    private List<OmsSaleReturnItem> saleReturnItemList = new ArrayList<>();

    public interface Save{

    }
    public interface Update{

    }

}
